#include "OtherTorque.h"

#include "ExchangeVector3.h"
#include "MutualDemagVector3.h"
#include "Constants.h"

#include <cmath>

OtherTorque::OtherTorque(Layer mag,Layer pol)
{
  Vector3 torque1,torque2;
  if(2!=1)
    {
      heff=ExchangeVector3(mag,pol);
      heff.add(MutualDemagVector3(pol));
      newGamma=Constants::GAMMA/(1+pow(mag.getAlpha(),2));
      newAlpha=newGamma*mag.getAlpha();
      torque1=mag.getMag();
      torque1.crossProduct(heff);
      torque2=mag.getMag();
      torque2.crossProduct(torque1);
      torque1.mult(-newGamma);
      torque2.mult(-newAlpha);
      torque1.add(torque2);
      x=torque1.getX();
      y=torque1.getY();
      z=torque1.getZ();
    }
  else 
    {
      x=0;
      y=0;
      z=0;
    }
}

OtherTorque::~OtherTorque()
{

}
